#pragma once
#include "ctrlwnd.h"

class CColorBlock : public CCtrlWnd
{
	DECLARE_DYNAMIC(CColorBlock)
public:
	CColorBlock(void);
	~CColorBlock(void);

	
	void			SetColor( const ColorMap& Color );
	void			GetColor(  ColorMap& Color );

	void			ResetBitmap();
	void			OnDraw();

private:
	int32			FindPropIndex( float32 fPos );
	int32			GetSeclectNode( CPoint& point );
	void			DeleteSeclectedNode();
	DWORD 			GetColor( float32 Percent );
	DWORD 			GetGDIColor( float32 Percent );
private:

	CBitmap			m_Bitmap;
	CDC				m_MemDC;
	DWORD*			m_pBit;

	CPoint			m_ptMouseStart;

	AdvancePropVec	m_vecColor;
	int32			m_nSeclected;

public:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnPaint();
};
